package com.project.service.impl;

import com.project.mapper.ReportContentMapper;
import com.project.model.entity.ReportContent;
import com.project.service.ReportContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ReportContentServiceImpl implements ReportContentService {
    private final ReportContentMapper reportContentMapper;

    @Autowired
    public ReportContentServiceImpl(ReportContentMapper reportContentMapper) {
        this.reportContentMapper = reportContentMapper;
    }

    @Override
    public ReportContent addReportContent(ReportContent reportContent) {

        reportContentMapper.insertReportContent(reportContent);
        return reportContent;
    }

    @Override
    public void deleteReportContent(Integer id) {
        reportContentMapper.deleteReportContentById(id);
    }

    @Override
    public ReportContent updateReportContent(ReportContent reportContent) {
        reportContentMapper.updateReportContent(reportContent);
        return reportContent;
    }

    @Override
    public ReportContent getReportContentById(Integer id) {
        return reportContentMapper.selectReportContentById(id);
    }

    @Override
    public List<ReportContent> getAllReportContents() {
        return reportContentMapper.selectAllReportContents();
    }

    @Override
    public List<ReportContent> getReportContentsByReportId(Integer reportId) {
        return reportContentMapper.selectReportContentsByReportId(reportId);
    }
}

